import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [

  {
    path: '/',
    name: 'layout',
    redirect: '/home',
    component:  () => import('@/Layout/index.vue'),
    children: [
        {
            name: 'home',
            path: '/home',
            component:  () => import('@/views/home/index.vue'),
        },
        {
            name: 'banner',
            path: '/banner',
            component:  () => import('@/views/Banner/index.vue'),
        },
        {
            name: 'bannerSave',
            path: '/banner/Save/:id?',
            component:  () => import('@/views/Banner/Save.vue'),
        },
        {
            name: 'collect',
            path: '/collect',
            component:  () => import('@/views/my/MyCollect.vue'),
        },
        {
            name: 'like',
            path: '/like',
            component:  () => import('@/views/my/MyLike.vue'),
        },
        {
            name: 'my',
            path: '/my',
            component:  () => import('@/views/my/index.vue'),
        },
        {
            name: 'question',
            path: '/question',
            component:  () => import('@/views/question/index.vue'),
        },
        {
            name: 'answer',
            path: '/answer',
            component:  () => import('@/views/answer/index.vue'),
        },
        {
            name: 'answerResult',
            path: '/answer/result',
            component:  () => import('@/views/answer/result.vue'),
        },
        {
            name: 'answerSave',
            path: '/answer/Save/:id?',
            component:  () => import('@/views/answer/view.vue'),
        },
        {
            name: 'questionSave',
            path: '/question/Save/:id?',
            component:  () => import('@/views/question/Save.vue'),
        },
        {
            name: 'notice',
            path: '/notice',
            component:  () => import('@/views/notice/index.vue'),
        },
        {
            name: 'noticeSave',
            path: '/notice/Save/:id?',
            component:  () => import('@/views/notice/Save.vue'),
        },
        {
            name: 'noticeDetail',
            path: '/notice/Detail/:id?',
            component:  () => import('@/views/notice/detail.vue'),
        },
        {
            name: 'news',
            path: '/news',
            component:  () => import('@/views/news/index.vue'),
        },
        {
            name: 'newsSave',
            path: '/news/Save/:id?',
            component:  () => import('@/views/news/Save.vue'),
        },
        {
            name: 'newsDetail',
            path: '/news/Detail/:id?',
            component:  () => import('@/views/news/detail.vue'),
        },
        {
            name: 'role',
            path: '/role',
            component:  () => import('@/views/role/index.vue'),
        },
        {
            name: 'roleSave',
            path: '/role/Save/:id?',
            component:  () => import('@/views/role/Save.vue'),
        },
        {
            name: 'user',
            path: '/user',
            component:  () => import('@/views/user/index.vue'),
        },
        {
            name: 'userSave',
            path: '/user/Save/:id?',
            component:  () => import('@/views/user/Save.vue'),
        },
        {
            name: 'cardList',
            path: '/cardList',
            component:  () => import('@/views/user/cardList.vue'),
        },
        {
            name: 'post',
            path: '/post',
            component:  () => import('@/views/post/index.vue'),
        },
        {
            name: 'postAdmin',
            path: '/postAdmin',
            component:  () => import('@/views/post/postAdmin.vue'),
        },
        {
            name: 'commentAdmin',
            path: '/postAdmin/comment/:id',
            component:  () => import('@/views/post/commentAdmin.vue'),
        },
    ]
  },
    // {
    //     path: '/login',
    //     name: 'login',
    //     component:  () => import('@/views/Login.vue'),
    // },
    {
        path: '/login',
        name: 'login',
        component: () =>  import('@/views/Login/loginForm.vue')
    },
    {
        path: '/register',
        name: 'register',
        component: () =>  import('@/views/Login/registerForm.vue')
    },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
